﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace tsgl
{
    public partial class mainForm : Form
    {
        public mainForm(string text1,string text2)
        {
            InitializeComponent();
            this.toolStripStatusLabel2.Text = "当前登录用户为：" + text1 + "";
            this.toolStripStatusLabel3.Text = "当前用户类型为：" + text2 + "";
        }

        private void mainForm_Load(object sender, EventArgs e)
        {
            
            this.splitContainer1.SplitterDistance = 220;
            this.toolStripStatusLabel4.Text = "系统当前时间：" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            this.timer1.Interval = 1000;
            this.timer1.Start();
            this.IsMdiContainer = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.toolStripStatusLabel4.Text = "系统当前时间：" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            toolStripButton1_Click(sender,e);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            借阅信息查询ToolStripMenuItem_Click(sender,e);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            toolStripButton3_Click(sender,e);
        }

        private void button7_Click(object sender, EventArgs e)
        {
            书目信息管理ToolStripMenuItem_Click(sender, e);
        }

        private void button8_Click(object sender, EventArgs e)
        {
            图书类型管理ToolStripMenuItem_Click(sender, e);
        }

        private void button9_Click(object sender, EventArgs e)
        {
            借阅者信息管理ToolStripMenuItem_Click(sender, e);
        }

        private void button10_Click(object sender, EventArgs e)
        {
            借阅者类型管理ToolStripMenuItem_Click(sender, e);
        }

        private void button11_Click(object sender, EventArgs e)
        {
            // 2356565664;
        }

        private void button12_Click(object sender, EventArgs e)
        {
            // 2356565664;
        }

        private void button13_Click(object sender, EventArgs e)
        {
            用户管理ToolStripMenuItem1_Click(sender, e);
        }

        private void mainForm_SizeChanged(object sender, EventArgs e)
        {
            this.splitContainer1.SplitterDistance = 220;
        }

        private void splitContainer1_Panel1_SizeChanged_1(object sender, EventArgs e)
        {
            //if (this.splitContainer1.SplitterDistance <= 220)
            //{
            //    this.splitContainer1.SplitterDistance = 220;
            //}
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (this.toolStripButton4.Text == "隐藏导航栏")
            {
                this.toolStripButton4.Text = "显示导航栏";
                this.splitContainer1.SplitterDistance = 0;
            }
            else
            {
                this.toolStripButton4.Text = "隐藏导航栏";
                this.splitContainer1.SplitterDistance = 220;
            }
        }

        private void 数据备份ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 数据恢复ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 用户管理ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            userManage frm = new userManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 用户权限操作ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            userPermission frm = new userPermission();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 修改用户密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            userPasswordEdit frm = new userPasswordEdit(this.toolStripStatusLabel3.Text.Substring(8).Trim(), this.toolStripStatusLabel2.Text.Substring(8).Trim());
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void 书目信息管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bibliothecaInfoManage frm = new bibliothecaInfoManage();
            frm.StartPosition = FormStartPosition.Manual;
            frm.Left = this.Left + this.splitContainer1.Panel1.Width + 10;
            frm.Top = this.Top + this.MainMenuStrip.Height + this.toolStrip1.Height + this.Height - this.ClientRectangle.Height - 3;
            frm.Width = this.splitContainer1.Panel2.Width;
            frm.Height = this.splitContainer1.Panel2.Height;
            //frm.MdiParent = this;
            frm.Show();
        }

        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void 编制图书条码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bookBarcodeEdit frm = new bookBarcodeEdit();
            //frm.MdiParent = this; 
            frm.Show();
        }

        private void 快速新增书目ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bibliothecaInfoAdd frm = new bibliothecaInfoAdd();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 图书入库ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 图书类型管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bookTypeManage frm = new bookTypeManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 借阅者信息管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            borrowerInfoManage frm = new borrowerInfoManage();
            frm.StartPosition = FormStartPosition.Manual;
            frm.Left = this.Left + this.splitContainer1.Panel1.Width + 10;
            frm.Top = this.Top + this.MainMenuStrip.Height + this.toolStrip1.Height + this.Height - this.ClientRectangle.Height - 3;
            frm.Width = this.splitContainer1.Panel2.Width;
            frm.Height = this.splitContainer1.Panel2.Height;
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 快速新增借阅者ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            borrowerInfoAdd frm = new borrowerInfoAdd();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 办理借书证ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 借阅者类型管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            borrowerTypeManage frm = new borrowerTypeManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 罚款处理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bookLoanManage frm = new bookLoanManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            this.timer2.Enabled = false;
            string str = this.toolStripStatusLabel2.Text.Substring(8);
            huanying huanying = new huanying(str);
            huanying.Show();
        }

        private void mainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("您是否真的要退出图书管理系统？", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
            {
                e.Cancel = true;
            }
            else
            {
                Application.Exit();
            }
        }

        private void 罚款类型管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bookReturnOrRenew frm = new bookReturnOrRenew();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 图书归还ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bookReturnOrRenew frm = new bookReturnOrRenew();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 图书超期罚款ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            penaltyManage frm = new penaltyManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 图书损坏罚款ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            penaltyManage frm = new penaltyManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 图书丢失罚款ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            penaltyManage frm = new penaltyManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 补交罚款ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            penaltyStay frm = new penaltyStay();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 罚款类型管理ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            penaltyTypeManage frm = new penaltyTypeManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 书目信息查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bibliothecaInfoManage frm = new bibliothecaInfoManage();
            frm.StartPosition = FormStartPosition.Manual;
            frm.Left = this.Left + this.splitContainer1.Panel1.Width + 10;
            frm.Top = this.Top + this.MainMenuStrip.Height + this.toolStrip1.Height + this.Height - this.ClientRectangle.Height - 3;
            frm.Width = this.splitContainer1.Panel2.Width;
            frm.Height = this.splitContainer1.Panel2.Height;
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 借阅者信息查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            borrowerInfoManage frm = new borrowerInfoManage();
            frm.StartPosition = FormStartPosition.Manual;
            frm.Left = this.Left + this.splitContainer1.Panel1.Width + 10;
            frm.Top = this.Top + this.MainMenuStrip.Height + this.toolStrip1.Height + this.Height - this.ClientRectangle.Height - 3;
            frm.Width = this.splitContainer1.Panel2.Width;
            frm.Height = this.splitContainer1.Panel2.Height;
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 借阅信息查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            loanQuery frm = new loanQuery();
            frm.Show();
        }

        private void 超期图书查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 书目报表打印ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 借阅者报表打印ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 借阅报表打印ToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void 部门信息管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            departmentManage frm = new departmentManage();
            frm.Show();
        }

        private void 出版社管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            publisherInfoManage frm = new publisherInfoManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 馆藏地点管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bookDepositary frm = new bookDepositary();
            frm.Show();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            bookLoanManage frm = new bookLoanManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            bookReturnOrRenew frm = new bookReturnOrRenew();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            penaltyManage frm = new penaltyManage();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            about frm = new about();
            //frm.MdiParent = this;
            frm.Show();
        }

        private void 水平平铺ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void 垂直平铺ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileVertical);
        }

        private void 窗口层叠ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.Cascade);
        }

        private void button15_Click(object sender, EventArgs e)
        {
            System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
            Info.FileName = "winword.exe";
            Info.Arguments = "";
            Info.WorkingDirectory = "c:/windows/";
            try
            {
                System.Diagnostics.Process.Start(Info);
            }
            catch
            {
                MessageBox.Show("系统找不到指定的程序文件", "错误提示！");
                return;
            }
        }

        private void button16_Click(object sender, EventArgs e)
        {
            System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
            Info.FileName = "excel.exe";
            Info.Arguments = "";
            Info.WorkingDirectory = "c:/windows/";
            try
            {
                System.Diagnostics.Process.Start(Info);
            }
            catch
            {
                MessageBox.Show("系统找不到指定的程序文件", "错误提示！");
                return;
            }
        }

        private void button17_Click(object sender, EventArgs e)
        {
            System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
            Info.FileName = "notepad.exe";
            Info.Arguments = "";
            Info.WorkingDirectory = "c:/windows/";
            try
            {
                System.Diagnostics.Process.Start(Info);
            }
            catch
            {
                MessageBox.Show("系统找不到指定的程序文件", "错误提示！");
                return;
            }
        }

        private void button18_Click(object sender, EventArgs e)
        {
            System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
            Info.FileName = "calc.exe";
            Info.Arguments = "";
            Info.WorkingDirectory = "c:/windows/";
            try
            {
                System.Diagnostics.Process.Start(Info);
            }
            catch
            {
                MessageBox.Show("系统找不到指定的程序文件", "错误提示！");
                return;
            }
        }
    }
}